//1.数组的去重
let arr = [1, 2, 3, 4, 2, 3] 
console.log("原数组："+arr)
let a = new Set(arr) 
console.log("去重后："+Array.from(a))
//2.合并去重
let arr1 = [1, 2, 3, 4] 
let arr2 = [2, 3, 4, 5, 6] 
console.log("原数组1："+arr1)
console.log("原数组2："+arr2)
let s = new Set([...arr1, ...arr2]) 
//console.log(s) 
//console.log([...s]) 
console.log("合并去重后："+Array.from(s)) 
//3.求交集
let s1 = new Set(arr1) 
let s2 = new Set(arr2) 
let result = new Set(arr1.filter(item => s2.has(item))) 
console.log("交集："+Array.from(result))
//4.求差集
let arr3 = new Set(arr1.filter(item => !s2.has(item))) 
let arr4 = new Set(arr2.filter(item => !s1.has(item))) 
//console.log(arr3) 
//console.log(arr4) 
console.log("差集："+[...arr3, ...arr4])